package com.hc.springbootes.entity;


import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;


@Document(indexName = "huachen",type = "emp")
public class Emp implements Serializable {
    @Id
    private Integer eid;
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String ename;
    @Field(type = FieldType.Keyword)
    private String sex;
    @Field(type = FieldType.Double)
    private Double salary;

    @Field(type = FieldType.Keyword)
    private String deptName;

    public Emp() {
    }

    public Emp(Integer eid, String ename, String sex, Double salary, String deptName) {
        this.eid = eid;
        this.ename = ename;
        this.sex = sex;
        this.salary = salary;
        this.deptName = deptName;
    }

    public Integer getEid() {
        return eid;
    }

    public void setEid(Integer eid) {
        this.eid = eid;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Double getSalary() {
        return salary;
    }

    public void setSalary(Double salary) {
        this.salary = salary;
    }


    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    @Override
    public String toString() {
        return "Emp{" +
                "eid=" + eid +
                ", ename='" + ename + '\'' +
                ", sex='" + sex + '\'' +
                ", salary=" + salary +
                ", deptName='" + deptName + '\'' +
                '}';
    }
    /**
     * 创建索引
     * PUT /huachen
     * {
     *     "settings":{
     *
     *     },
     *     "mappings":{
     *         "emp":{
     *             "properties":{
     *                 "eid":{
     *                     "type":"keyword"
     *                 },
     *                 "ename":{
     *                     "type":"text",
     *                     "analyzer":"ik_max_word"
     *                 },
     *                 "sex":{
     *                     "type":"keyword"
     *                 },
     *                 "salary":{
     *                     "type":"double"
     *                 },
     *                 "deptName":{
     *                     "type":"keyword"
     *                 }
     *             }
     *         }
     *     }
     * }
     */
}
